package sybl.lx.com.vpitest;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;

import com.viewpagerindicator.TitlePageIndicator;

import java.util.ArrayList;

import sybl.lx.com.vpitest.adapter.VpAadapter;
import sybl.lx.com.vpitest.fragment.TestFragment;

public class MainActivity extends FragmentActivity {

    private TitlePageIndicator titles;
    private VpAadapter adapter;
    private android.support.v4.view.ViewPager vpvpitest;
    private ArrayList<Fragment> fragments=new ArrayList<Fragment>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_vpi_main);
        this.vpvpitest = (ViewPager) findViewById(R.id.vp_vpitest);
        this.titles = (TitlePageIndicator) findViewById(R.id.titles);

        fragments.add(new TestFragment());
        fragments.add(new TestFragment());
        fragments.add(new TestFragment());
        fragments.add(new TestFragment());

        adapter=new VpAadapter(getSupportFragmentManager(),fragments);
        vpvpitest.setAdapter(adapter);

        titles.setViewPager(vpvpitest);



    }

}
